using MediatR;
using B.S.XZYData.ErrorCode;

namespace B.S.XZYData.Api.Read.Application.Command.Process
{
    /// <summary>
    /// 工序分页查询命令
    /// </summary>
    public class QueryProcessCommand : IRequest<ApiResult<ProcessPageResult>>
    {
        /// <summary>
        /// 页码
        /// </summary>
        public int PageNumber { get; set; } = 1;

        /// <summary>
        /// 每页数量
        /// </summary>
        public int PageSize { get; set; } = 30;

        /// <summary>
        /// 工序编号
        /// </summary>
        public string? ProcessNumber { get; set; }

        /// <summary>
        /// 工序名称
        /// </summary>
        public string? ProcessName { get; set; }

        /// <summary>
        /// 报工权限
        /// </summary>
        public string? ReportingPermissions { get; set; }

        /// <summary>
        /// 报工数配比开始值
        /// </summary>
        public int? ReportingRatioStart { get; set; }

        /// <summary>
        /// 报工数配比结束值
        /// </summary>
        public int? ReportingRatioEnd { get; set; }

        /// <summary>
        /// 不良品项列表
        /// </summary>
        public string? DefectiveItemList { get; set; }

        /// <summary>
        /// 测试字段1
        /// </summary>
        public string? TestField1 { get; set; }

        /// <summary>
        /// 测试字段2
        /// </summary>
        public string? TestField2 { get; set; }

        /// <summary>
        /// 创建时间开始
        /// </summary>
        public DateTime? CreationTimeStart { get; set; }

        /// <summary>
        /// 创建时间结束
        /// </summary>
        public DateTime? CreationTimeEnd { get; set; }

        /// <summary>
        /// 排序字段
        /// </summary>
        public string SortField { get; set; } = "Id";

        /// <summary>
        /// 排序方向 (asc/desc)
        /// </summary>
        public string SortDirection { get; set; } = "desc";
    }

    /// <summary>
    /// 工序分页查询结果
    /// </summary>
    public class ProcessPageResult
    {
        /// <summary>
        /// 总记录数
        /// </summary>
        public int TotalCount { get; set; }

        /// <summary>
        /// 当前页数据
        /// </summary>
        public List<ProcessDto> Data { get; set; } = new List<ProcessDto>();

        /// <summary>
        /// 当前页码
        /// </summary>
        public int PageNumber { get; set; }

        /// <summary>
        /// 每页数量
        /// </summary>
        public int PageSize { get; set; }

        /// <summary>
        /// 总页数
        /// </summary>
        public int TotalPages { get; set; }
    }

    /// <summary>
    /// 工序数据传输对象
    /// </summary>
    public class ProcessDto
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 工序编号
        /// </summary>
        public string ProcessNumber { get; set; } = string.Empty;

        /// <summary>
        /// 工序名称
        /// </summary>
        public string ProcessName { get; set; } = string.Empty;

        /// <summary>
        /// 报工权限
        /// </summary>
        public string ReportingPermissions { get; set; } = string.Empty;

        /// <summary>
        /// 报工数配比
        /// </summary>
        public int ReportingRatio { get; set; }

        /// <summary>
        /// 不良品项列表
        /// </summary>
        public string? DefectiveItemList { get; set; }

        /// <summary>
        /// 测试字段1
        /// </summary>
        public string? TestField1 { get; set; }

        /// <summary>
        /// 测试字段2
        /// </summary>
        public string? TestField2 { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreatorDate { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public string? Creator { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime? UpdatorDate { get; set; }

        /// <summary>
        /// 修改人
        /// </summary>
        public string? Updator { get; set; }
    }
} 